﻿using B.S.Data.MES.API.Applications.QualityManagement.ExamineTaskCommand.Commands;
using B.S.Domain.BasicData.QualityManagement;
using B.S.Infratrctrue;
using B.S.Requst;
using MediatR;

namespace B.S.Data.MES.API.Applications.QualityManagement.ExamineTaskCommand.CommandHandlers
{
    public class ShowExamineDesignCommandHandler : IRequestHandler<ShowExamineDesignCommand, APIRequst<List<ExamineDesign>>>
    {
        private readonly IBaseRepository<ExamineDesign> _examinedesignRepository;
        public ShowExamineDesignCommandHandler(IBaseRepository<ExamineDesign> examinedesignRepository)
        {
            _examinedesignRepository = examinedesignRepository;
        }
        public Task<APIRequst<List<ExamineDesign>>> Handle(ShowExamineDesignCommand request, CancellationToken cancellationToken)
        {
            var list = _examinedesignRepository.GetAll();
            return Task.FromResult(new APIRequst<List<ExamineDesign>>
            {

                Data = list.ToList(),
                Code = RequstCode.成功,
                Msg=RequstCode.成功.ToString()

            });

        }
    }
}
